$(document).ready(function() {
	menuSelect('myFiles');
	$('#btnDownload').click(onDownloadClick);
	$('#btnUpload').click(onUploadClick);
});

function onDownloadClick() {
	var selected = $('#lstFiles option:selected').val();
	
	if (!selected) {
		alert('Please select a file to download.');
		return;
	}
	
	var contextPath = $('#contextPath').val();
	var downloadUrl = contextPath + '/FilesServlet?action=downloadUserFile&filename=' + selected;
	$('#ifrDownload').attr("src", downloadUrl);
}

function onUploadClick() {
	var filename = $('#uploadFile').val();
	
	if (filename == '') {
		alert('Please select a file to upload.');
		return false;
	}		
}